package com.yoofn.framework.item

import android.databinding.BaseObservable
import android.databinding.DataBindingUtil
import android.databinding.ViewDataBinding
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import com.yanzhenjie.nohttp.rest.Response
import com.yoofn.framework.fragment.BaseFragment
import com.yoofn.framework.http.IHttpFramework

/**
 * Created by kalshen on 17-9-4.
 * @描述
 */

abstract class BaseItem<T : ViewDataBinding>(recyclerView: RecyclerView) : BaseObservable(), IHttpFramework {

    var position: Int = 0
    var list: List<BaseItem<out ViewDataBinding>>? = null
    var fragment: BaseFragment<out ViewDataBinding>? = null
    var recyclerView: RecyclerView? = null
    var size: Int = 0
    var contentView: T
    lateinit var rootView: View

    abstract val type: Int

    init {
        contentView = DataBindingUtil.inflate<T>(LayoutInflater.from(recyclerView.context), type, recyclerView, false)
        rootView = contentView.root
    }



    open fun initView() {

    }

    override fun doBusiness(what: Int, response: Response<String>) {

    }

    open class BaseBean

}